#!objective scoretp_z

scoreboard players operation #scoretp__distance scoretp_z = @s scoretp_z

# Negative direction

execute if score #scoretp__distance scoretp_z matches ..-16777216 at @s run tp @s ~ ~ ~-16777216
execute if score #scoretp__distance scoretp_z matches ..-16777216 run scoreboard players add #scoretp__distance scoretp_z 16777216

execute if score #scoretp__distance scoretp_z matches ..-8388608 at @s run tp @s ~ ~ ~-8388608
execute if score #scoretp__distance scoretp_z matches ..-8388608 run scoreboard players add #scoretp__distance scoretp_z 8388608

execute if score #scoretp__distance scoretp_z matches ..-4194304 at @s run tp @s ~ ~ ~-4194304
execute if score #scoretp__distance scoretp_z matches ..-4194304 run scoreboard players add #scoretp__distance scoretp_z 4194304

execute if score #scoretp__distance scoretp_z matches ..-2097152 at @s run tp @s ~ ~ ~-2097152
execute if score #scoretp__distance scoretp_z matches ..-2097152 run scoreboard players add #scoretp__distance scoretp_z 2097152

execute if score #scoretp__distance scoretp_z matches ..-1048576 at @s run tp @s ~ ~ ~-1048576
execute if score #scoretp__distance scoretp_z matches ..-1048576 run scoreboard players add #scoretp__distance scoretp_z 1048576

execute if score #scoretp__distance scoretp_z matches ..-524288 at @s run tp @s ~ ~ ~-524288
execute if score #scoretp__distance scoretp_z matches ..-524288 run scoreboard players add #scoretp__distance scoretp_z 524288

execute if score #scoretp__distance scoretp_z matches ..-262144 at @s run tp @s ~ ~ ~-262144
execute if score #scoretp__distance scoretp_z matches ..-262144 run scoreboard players add #scoretp__distance scoretp_z 262144

execute if score #scoretp__distance scoretp_z matches ..-131072 at @s run tp @s ~ ~ ~-131072
execute if score #scoretp__distance scoretp_z matches ..-131072 run scoreboard players add #scoretp__distance scoretp_z 131072

execute if score #scoretp__distance scoretp_z matches ..-65536 at @s run tp @s ~ ~ ~-65536
execute if score #scoretp__distance scoretp_z matches ..-65536 run scoreboard players add #scoretp__distance scoretp_z 65536

execute if score #scoretp__distance scoretp_z matches ..-32768 at @s run tp @s ~ ~ ~-32768
execute if score #scoretp__distance scoretp_z matches ..-32768 run scoreboard players add #scoretp__distance scoretp_z 32768

execute if score #scoretp__distance scoretp_z matches ..-16384 at @s run tp @s ~ ~ ~-16384
execute if score #scoretp__distance scoretp_z matches ..-16384 run scoreboard players add #scoretp__distance scoretp_z 16384

execute if score #scoretp__distance scoretp_z matches ..-8192 at @s run tp @s ~ ~ ~-8192
execute if score #scoretp__distance scoretp_z matches ..-8192 run scoreboard players add #scoretp__distance scoretp_z 8192

execute if score #scoretp__distance scoretp_z matches ..-4096 at @s run tp @s ~ ~ ~-4096
execute if score #scoretp__distance scoretp_z matches ..-4096 run scoreboard players add #scoretp__distance scoretp_z 4096

execute if score #scoretp__distance scoretp_z matches ..-2048 at @s run tp @s ~ ~ ~-2048
execute if score #scoretp__distance scoretp_z matches ..-2048 run scoreboard players add #scoretp__distance scoretp_z 2048

execute if score #scoretp__distance scoretp_z matches ..-1024 at @s run tp @s ~ ~ ~-1024
execute if score #scoretp__distance scoretp_z matches ..-1024 run scoreboard players add #scoretp__distance scoretp_z 1024

execute if score #scoretp__distance scoretp_z matches ..-512 at @s run tp @s ~ ~ ~-512
execute if score #scoretp__distance scoretp_z matches ..-512 run scoreboard players add #scoretp__distance scoretp_z 512

execute if score #scoretp__distance scoretp_z matches ..-256 at @s run tp @s ~ ~ ~-256
execute if score #scoretp__distance scoretp_z matches ..-256 run scoreboard players add #scoretp__distance scoretp_z 256

execute if score #scoretp__distance scoretp_z matches ..-128 at @s run tp @s ~ ~ ~-128
execute if score #scoretp__distance scoretp_z matches ..-128 run scoreboard players add #scoretp__distance scoretp_z 128

execute if score #scoretp__distance scoretp_z matches ..-64 at @s run tp @s ~ ~ ~-64
execute if score #scoretp__distance scoretp_z matches ..-64 run scoreboard players add #scoretp__distance scoretp_z 64

execute if score #scoretp__distance scoretp_z matches ..-32 at @s run tp @s ~ ~ ~-32
execute if score #scoretp__distance scoretp_z matches ..-32 run scoreboard players add #scoretp__distance scoretp_z 32

execute if score #scoretp__distance scoretp_z matches ..-16 at @s run tp @s ~ ~ ~-16
execute if score #scoretp__distance scoretp_z matches ..-16 run scoreboard players add #scoretp__distance scoretp_z 16

execute if score #scoretp__distance scoretp_z matches ..-8 at @s run tp @s ~ ~ ~-8
execute if score #scoretp__distance scoretp_z matches ..-8 run scoreboard players add #scoretp__distance scoretp_z 8

execute if score #scoretp__distance scoretp_z matches ..-4 at @s run tp @s ~ ~ ~-4
execute if score #scoretp__distance scoretp_z matches ..-4 run scoreboard players add #scoretp__distance scoretp_z 4

execute if score #scoretp__distance scoretp_z matches ..-2 at @s run tp @s ~ ~ ~-2
execute if score #scoretp__distance scoretp_z matches ..-2 run scoreboard players add #scoretp__distance scoretp_z 2

execute if score #scoretp__distance scoretp_z matches ..-1 at @s run tp @s ~ ~ ~-1
